<template>
  <div class="child">
    <span>钱数{{ modelValue }}</span>
    <hr />
    <button @click="handler">父子组件数据同步</button>
  </div>
</template>

<script setup lang="ts">
//接受父组件传递过来props
let props = defineProps(["modelValue"]);

//触发自定义事件
let $emit = defineEmits(["update:modelValue"]);

const handler = () => {
  $emit("update:modelValue", props.modelValue + 1000);
};
</script>

<style scoped>
.child {
  width: 500px;
  height: 230px;
  background-color: skyblue;
}
</style>
